<template>
  <div id="app">
    <div class="row"
         style="backgroundColor:lightblue">
      <div class="col-lg-offset-2 col-lg-8">
        <div class="page-header">
          <h1>Vue路由的小案例</h1>
          <button @click="forward">前进</button>
          <button @click="back">后退</button>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-lg-2 col-lg-offset-2">
        <div class="list-group">
          <!-- 使用 router-link 组件来导航. -->
          <!-- 通过传入 `to` 属性指定链接. -->
          <!-- <router-link> 默认会被渲染成一个 `<a>` 标签 -->
          <router-link class="list-group-item"
                       active-class="active"
                       to="/about">About</router-link>
          <router-link class="list-group-item"
                       active-class="active"
                       to="/home">Home</router-link>
        </div>
      </div>
      <div class="col-lg-6">
        <div class="panel">
          <div class="panel-body">
            <!-- 路由出口 -->
            <!-- 路由匹配到的组件将渲染在这里 -->
            <router-view></router-view>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'App',
  components: {

  },
  methods: {
    forward () {
      this.$router.forward();
    },
    back () {
      this.$router.back();
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  width: 1200px;
  margin: 60px auto;
}
</style>
